trigger DiscussionMessageAfterUpdate on DiscussionMessage__c (after update) 
{
	if (!TeamUtil.currentlyExeTrigger) 
	{
		try 
		{	
        	DiscussionForumSubscribersEmailServices DFEmail = new DiscussionForumSubscribersEmailServices();
        	DiscussionMessage__c dMsg = new DiscussionMessage__c();
            for(DiscussionMessage__c t : Trigger.new)
            {	
            dMsg = [ SELECT Id FROM DiscussionMessage__c WHERE DiscussionTopic__c =: t.DiscussionTopic__c ORDER BY CreatedDate LIMIT 1 ];
            	
            	if( dMsg.Id == t.Id )
            		DFEmail.sendNewTopicMessage( t.DiscussionTopic__c, 'update' );
            	else  
            		DFEmail.sendNewReplyMessage( t.Id, 'update' );		
            }
		} 
		finally 
		{
        	TeamUtil.currentlyExeTrigger = false;
		}
	}
}